package merchant.space;




import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyCollectionsAdapter extends BaseAdapter  {

		private MyCollectionsActivity context;
		private Navigation navigation;
	    private Collections collections;

	    public MyCollectionsAdapter(MyCollectionsActivity cont, Navigation n) {
	        this.context = cont;
	        this.navigation = n;
	      //  collections=navigation.getCollections();
	        //   collections=DataLink.getMyCollections();
	    //  collections=context.getCollections();
	       collections= DataLink.myCollections;
	       Log.d("WHYYY",String.valueOf(collections.size()));
	        }

	    public int getCount() {
	        return collections.size();
	    }

	    public Object getItem(int position) {
	        return collections.get(position);
	    }

	    public long getItemId(int position) {
	        return collections.get(position).getId();
	    }

	    public View getView(int position, View convertView, ViewGroup viewGroup) {
	    	
	      //  Phonebook entry = listPhonebook.get(position);
	        Collection collection = collections.get(position);
	       
	        if (convertView == null) {
	        /*    LayoutInflater inflater = (LayoutInflater) context
	                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	            convertView = inflater.inflate(R.layout.mycollections, null);*/
	            
	            LayoutInflater inflater2 = context.getLayoutInflater();
		        convertView = inflater2.inflate(R.layout.mycollections,viewGroup, false);
	        }
	       
	        
	      
	        ((TextView) convertView.findViewById(R.id.name)).setText(collection.getName());
	        ((TextView) convertView.findViewById(R.id.cattegory)).setText(collection.getCattegory());
	        
	       
	       
	        return convertView;
	    }

		
	  

	}



	
	

